package com.example.usermanager.tools;

import com.example.usermanager.model.UserInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class SessionUtil {
    public static UserInfo getUserBySession(HttpServletRequest httpServletRequest){
        UserInfo userInfo=null;
        HttpSession session = httpServletRequest.getSession(false);
        if (session!=null)
            userInfo= (UserInfo) session.getAttribute(AppFinal.USERINFO_SESSION_KEY);
        return userInfo;
    }
}
